package com.geovis.emergency.spd.biz.resources.service.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.geovis.emergency.spd.biz.resources.mapper.BsFxkhzjzMapper;
import com.geovis.emergency.spd.biz.resources.service.BsFxkhzjzService;
import com.geovis.emergency.spd.entity.resources.dto.BsFxkhzjzDetailDTO;
import com.geovis.emergency.spd.entity.resources.dto.ResourceListDTO;
import com.geovis.emergency.spd.entity.resources.entity.BsFxkhzjz;
import com.geovis.emergency.spd.entity.resources.entity.BsShyjjydw;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

@Slf4j
@Service
@RequiredArgsConstructor
@DS("buffer")
public class BsFxkhzjzServiceImpl extends ServiceImpl<BsFxkhzjzMapper, BsFxkhzjz> implements BsFxkhzjzService {
    @Override
    public List<ResourceListDTO> getFxkhzjz() {

        ResourceListDTO listDTO=new ResourceListDTO();
        listDTO.setTitle("应急专家")
                .setLatitude(Double.parseDouble("36.30"))
                .setLongitude(Double.parseDouble("120.40"))
                .setTypeName("应急专家");
        return Arrays.asList(listDTO);
    }

    @Override
    public List<BsFxkhzjzDetailDTO> getFxkhzjzDetail() {
        List<BsFxkhzjz> fxkhzjzs=this.list();
        return fxkhzjzs.stream().map(fxkhzjz->{

            BsFxkhzjzDetailDTO detailDTO=new BsFxkhzjzDetailDTO();
            detailDTO.setName(fxkhzjz.getUserName())
                    .setUnitName(fxkhzjz.getUnitName());
            return detailDTO;

        }).collect(Collectors.toList());
    }
}
